﻿using SDDLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace PSDClient.Service
{
    

    public static class Setting
    {
        public static API API { get; private set; }

        public static string ApiServerAddress { get; set; }
        public static string TcpServerAddress { get; private set; }
        public static int TcpServerPort { get; private set; }

        public static int PSDPort { get; private set; }

        public static string DownloadServerIP { get; set; }
        public static ushort DownloadServerPort { get; set; }

        public static string DownloadServerUserId { get; set; }

        public static string DownloadServerPwd { get; set; }
        public static int MaxDownloadProcess { get; set; }

        public static int DeviceConnectType { get; set; }

        public static string DefaultDataPath { get; set; }


        public static IPEndPoint PDMEndPoint { get; set; }

        static Setting()
        {
            API = new API();
            ApiServerAddress = System.Configuration.ConfigurationManager.AppSettings["ApiServerAddress"];
            TcpServerAddress = System.Configuration.ConfigurationManager.AppSettings["TcpServerAddress"];
            TcpServerPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["TcpServerPort"]);
            PSDPort = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["PSDPort"]);

            foreach (var p in API.GetType().GetProperties())
            {
                p.SetValue(API, ApiServerAddress + "api/VideoDownload/" + p.Name);
            }

            DeviceConnectType = 1;

            DefaultDataPath = "录像备份";

            MaxDownloadProcess = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MaxDownloadProcess"]);
        }
    }
}
